# from pathlib import Path
# from typing import Optional, List
#
# from appscript import app, k
# from mactypes import Alias
#
#
# # TODO: Only works on mac, rewrite for more compatibility
# class Outlook:
#     def __init__(self):
#         self.client = app('Microsoft Outlook')
#
#
# class Message:
#     def __init__(self,
#                  parent: Optional[Outlook] = None,
#                  subject: str = '',
#                  body: str = '',
#                  to_recip: Optional[List[str]] = None,
#                  cc_recip: Optional[List[str]] = None,
#                  show: bool = False):
#         if parent is None:
#             parent = Outlook()
#         client = parent.client
#
#         if to_recip is None:
#             to_recip = []
#
#         if cc_recip is None:
#             cc_recip = []
#
#         self.msg = client.make(
#             new=k.outgoing_message,
#             with_properties={k.subject: subject, k.content: body}
#         )
#
#         self.add_recipients(emails=to_recip, type_='to')
#         self.add_recipients(emails=cc_recip, type_='cc')
#
#         if show:
#             self.show()
#
#     def show(self):
#         self.msg.open()
#         self.msg.activate()
#
#     def send(self):
#         self.msg.send()
#         self.msg.activate()
#
#     def add_attachment(self, p):
#         # p is a Path() obj, could also pass string
#         p = Alias(str(p))  # convert string/path obj to POSIX/mactypes path
#         self.msg.make(new=k.attachment, with_properties={k.file: p})
#
#     def add_recipients(self, emails, type_='to'):
#         if not isinstance(emails, list):
#             emails = [emails]
#         for email in emails:
#             self.add_recipient(email=email, type_=type_)
#
#     def add_recipient(self, email, type_='to'):
#         if type_ == 'to':
#             recipient = k.to_recipient
#         elif type_ == 'cc':
#             recipient = k.cc_recipient
#         else:
#             raise RuntimeError('Unknown type of recipient.')
#         self.msg.make(new=recipient, with_properties={k.email_address: {k.address: email}})
#
#
# def send_message(subject: str,
#                  body: str,
#                  to_recip: List[str],
#                  cc_recip: Optional[List[str]] = None,
#                  attachments: Optional[List[str]] = None):
#     if cc_recip is None:
#         cc_recip = []
#     if attachments is None:
#         attachments = []
#     msg = Message(subject=subject, body=body, to_recip=to_recip, cc_recip=cc_recip)
#     # attach file
#     for attachment in attachments:
#         p = Path(attachment)
#         msg.add_attachment(p)
#     msg.send()
